package code62;

import java.util.Random;

public class LearnMath {
    public static void main(String[] args) {

        // TODO 调用的都是Math里的静态方法，Math的构造函数是private的，不能创建Math类的实例
        System.out.println(Math.random());

        // TODO 原来归根结底，Math的random是用Random类来实现的，它在java.util里
        Random random = new Random();
        for (int i = 0; i < 100; i++) {
            // TODO nextInt的返回值有负数，需要取绝对值
            System.out.println(Math.abs(random.nextInt()));
        }

        System.out.println(Math.abs(-9));

        System.out.println(Math.round(-9.2));
        System.out.println(Math.round(-9.5));
        System.out.println(Math.round(-9.8));
        System.out.println(Math.round(9.2));
        System.out.println(Math.round(9.5));
        System.out.println(Math.round(9.8));
    }

}
